import java.util.Scanner;
//快乐数
public class isHappy {
    public static void main(String[] args) {
        Scanner in  = new Scanner(System.in);
        int n = in.nextInt();

    }
    public int bitSum(int n) {
        int sum = 0;
        while(n != 0) {
            int t = n % 10;
            sum += t * t;
            n = n / 10;
        }
        return sum;
    }
        public boolean isHappy(int n) {
           int slow = n;
           int fast = bitSum(n);
               while(slow != fast) {
               slow = bitSum(slow);
               fast = bitSum(bitSum(fast));
        }
               if (slow == 1) {
                   return true;
               }
               return false;
    }
}
